next up previous contents index
Next: Random Up: Functions and Procedures Previous: Pos

Ptr

   

Declaration:

Function Ptr (Sel,Off : Longint) : Pointer;

Description:

Ptr returns a pointer, pointing to the address specified by segmentSel and offset Off.

Remark 1: In the 32-bit flat-memory model supported by Free Pascal, this function is obsolete.

Errors:

Remark 2:

See also:

The returned address is simply the offset. If you recompile the RTL with -dDoMapping defined, then the compiler returns the following : ptr:=pointer($e0000000+sel shl 4+off) under DOS, or ptr:=pointer(sel shl 4+off) on other OSes. None. Addr

Example
Program Example59;

{ Program to demonstrate the Ptr function. }

Var P : ^String;
    S : String;
    
begin
  S:='Hello, World !';
  P:=Ptr(Seg(S),Longint(Ofs(S)));
  {P now points to S !}
  Writeln (P^);
end.



Michael Van Canneyt
Tue Mar 31 16:48:49 CEST 1998